package march.test_3_6;

import java.util.Scanner;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        int tmp = 1;
        String str = scanner.nextLine();
        for(int i = 0; i < str.length(); i++) {
            if(tmp == 1 && str.charAt(i) == 'U') {
                tmp = n;
            }else if(tmp == n && str.charAt(i) == 'D') {
                tmp = 1;
            }else if(str.charAt(i) == 'U') {
                tmp--;
            } else {
                tmp++;
            }
        }
        if(n <= 4) {
            for (int i = 1; i <= n; i++) {
                System.out.print(i + " ");
            }
            System.out.println();
            System.out.println(tmp);
            return;
        }
        if(tmp <= 3) {

        }
        if(n - tmp >= 4) {
            for (int i = 0; i < 4; i++) {
                System.out.print(tmp + i + " ");
            }
            System.out.println();
            System.out.println(tmp);
        } else {
            int count = n - tmp;
            count = 4 -count;
            for(int i = count - 1; i > 0; i--) {
                System.out.print(tmp - i + " ");
            }

            for (int i = 0; i <= n - tmp; i++) {
                System.out.print(tmp + i + " ");
            }
            System.out.println();
            System.out.println(tmp);
        }
    }
}
